package chapter7.HashSet;

public class Person {
    private String name;
    private long id_card;
    public Person(String name, long id_card) {
        this.name = name;
        this.id_card = id_card;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public long getId_card() {
        return id_card;
    }
    public void setId_card(long id_card) {
        this.id_card = id_card;
    }
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (int) (id_card ^ (id_card >>> 32));
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Person other = (Person) obj;
        if (id_card != other.id_card)
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        return true;
    }
}
